﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace 学生成绩查询及选课系统.student
{
    public partial class myClass : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }

        public void bind()
        {
            string sql = "select s1.classno as '班号',classname as '班名',stuname as '学生姓名',stugender as '性别（男为1，女为0）',stuage as '年龄' from student s1 join class on class.classno=s1.classno where (select s2.classno from student s2 where s2.stuno=" + Session["user"].ToString() + " )=s1.classno and class.clastate=1";
            DataTable dt = DBAccess.GetTable(sql);
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }
}